<template>
  <div class="my-train">
    <div class="classify" @click="is_mask = true">
      <p>
        <span>{{classify_name}}</span>
        <img class="classify-img" src="@/assets/shangcheng05.png" alt="">
      </p>
    </div>
    <div class="list">
      <div class="item">
        <div class="left">
          <p class="title">「办卡」智慧宝太古汇旗舰店</p>
          <p class="time">2018.11.13 15:24</p>
        </div>
        <div class="right">
          <p class="title">+5次</p>
          <p class="time">剩余5次</p>
        </div>
      </div>
    </div>
    <div class="mask-div" v-if="is_mask">
      <div class="mask-bg" @click="is_mask = false"></div>
      <div class="content">
        <div class="classify" @click="classify(1, '全部')">
          <p>
            <span>全部</span>
            <img class="classify-img" src="@/assets/shangcheng07.png" alt="">
          </p>
        </div>
        <div class="list-item clear">
          <div class="item" :class="(classifyNum == 1) ? 'active' : ''" @click="classify(1, '分类1')">全部</div>
          <div class="item" :class="(classifyNum == 2) ? 'active' : ''" @click="classify(2, '分类2')">二阶魔方</div>
          <div class="item" :class="(classifyNum == 3) ? 'active' : ''" @click="classify(3, '分类3')">三阶魔方</div>
          <div class="item" :class="(classifyNum == 4) ? 'active' : ''" @click="classify(4, '分类4')">创意·鲁班系列</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import newsList from '@/components/newsList'
import 'swiper/dist/css/swiper.css'

  export default {
    components: {
      swiper,
      swiperSlide,
      newsList
    },
    data () {
      return {
        bannerHome: {
          loop: true,
          pagination: {
            el: '.swiper-pagination',
            clickable: true
          }
        },
        classifyNum: 0,
        is_mask: false,
        classify_name: '全部商品'
      }
    },
    created () {
    },
    methods: {
      router (path) {
        this.$router.push(path)
      },
      classify (index, classify_name) {
        this.classifyNum = index
        this.is_mask = false
        this.classify_name = classify_name
      }
    }
  }
</script>

<style lang="stylus" scoped>
.my-train
  background-color #f5f5f5
  min-height 100vh
  padding-bottom 5rem
  .classify
    padding 0 1.5rem
    line-height 4.5rem
    height 4.5rem
    color #333
    font-weight 500
    font-size 1.7rem
    position sticky
    border-bottom 1px solid #e6e6e6
    margin-bottom 1rem
    top 0
    background-color #fff
    text-align center
    .classify-img
      display inline-block
      vertical-align middle
      width .8rem
      position relative
      top -.2rem
  .content
    width 100%
    top 0
    left 0
    background-color #fff
    .list-item
      padding 1.5rem
      padding-bottom .5rem
      .item.active
        color #172F6D
        border 1px solid #172F6D
      .item
        border 1px solid #ccc
        color #999
        font-size 1.5rem
        padding .9rem 1.2rem
        float left
        margin-right 1rem
        margin-bottom 1rem
        height 1.5rem
        line-height 1.5rem
  .list
    width 100%
    height 100vh
    background-color #f5f5f5
    .item
      display flex
      height 7rem
      background-color #fff
      padding 0 1.6rem
      border-bottom 1px solid #e6e6e6
      &:last-child
        border none
      .title
        font-size 1.5rem
        color #333
        overflow hidden
        white-space nowrap
        text-overflow ellipsis
        line-height 2rem
        height 2rem
        margin-bottom .4rem
        margin-top 1.5rem
        width 25rem
        margin-left -.8rem
      .time
        color #999
        font-size 1.2rem
        line-height 1.6rem
        height 1.6rem
      .left
        flex 3
      .right
        flex 1
        p
          width 100%
          text-align right
          margin-left 0
</style>
